package com.hanserwei.springbootlearn.mapper;

import com.hanserwei.springbootlearn.entity.Teacher;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TeacherMapper {
    @Select("select * from teachers as t left join student_teacher_association as st on t.teacher_id=st.teacher_id where student_id = #{studentId}")
    @Results({
            @Result(id = true, column = "teacher_id", property = "teacherId"),
            @Result(column = "teacher_name", property = "teacherName"),
            @Result(column = "department", property = "department")
    })
    List<Teacher> queryTeachersByStudentId(Integer studentId);
}
